package com.mszlu.blog.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author linKe
 * 统一消息响应类
 */
@Data
@AllArgsConstructor
public class Result {
    @ApiModelProperty("布尔类型消息提示")
    private boolean success;
    @ApiModelProperty("响应状态码")
    private int code;
    @ApiModelProperty("提示消息")
    private String msg;
    @ApiModelProperty("响应数据")
    private Object data;


    public static Result success(Object data){
        return new Result(true,200,"success",data);
    }

    public static Result fail(int code, String msg){
        return new Result(false,code,msg,null);
    }
}
